"""
Project Euler Problem 5: https://projecteuler.net/problem=5

Smallest multiple

2520 is the smallest number that can be divided by each of the numbers
from 1 to 10 without any remainder.

What is the smallest positive number that is _evenly divisible_ by all
of the numbers from 1 to 20?
"""

# _*_ conding:UTF-8 _*_
'''
@author = Kuperain
@email = kuperain@aliyun.com
@IDE = Thonny Python3.8
@creat_time = 2022/5/4
'''


def solution1(n: int = 20) -> int:
    '''
    >>> solution1(10)
    2520
    >>> solution1(3)
    6
    '''
    
    an = list(range(n//2,n+1))
    res = 1
    
    import math
    for a in an:
        res = res * a // math.gcd(res, a)
    
    return res


if __name__ == "__main__":
    import doctest, time
    doctest.testmod(verbose = True)
    
    start = time.time()
    
    print(f"{solution1() = }")
    time1 = time.time()
    print(f'耗时：{time1 - start}s')
    


